<template>
  <h1>(自定义组件v-model)</h1>
  <h3>{{modelValue}}</h3>
  <h3>{{title}}</h3>
  <input :value="modelValue" @input="$emit('update:modelValue',$event.target.value)" />
  <button @click="$emit('update:title','自定义组件的v-model')">修改title</button>
</template>

<script>
import { toRefs } from 'vue'
export default {
  props: ['modelValue', 'title'],
  emits: ['update:modelValue', 'update:title'],
  setup (props, context) {

    return {
      ...toRefs(props)
    }
  }
}
</script>

<style>
</style>